﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using JavaSubstitutes;

namespace Sprites
{
	public class Particle: Sprite
	{
		public int life;

		public Particle(int x, int y, double xa, double ya): this(x, y, xa, ya, (int)(RandomExtensions.random() * 2), 0)
		{
			
		}

		public Particle(int x, int y, double xa, double ya, int xPic, int yPic)
		{
			sheet = Art.particles;
			this.x = x;
			this.y = y;
			this.xDelta = xa;
			this.yDelta = ya;
			this.xPic = xPic;
			this.yPic = yPic;
			this.xPicO = 4;
			this.yPicO = 4;

			wPic = 8;
			hPic = 8;
			life = 10;
		}

		public override void move()
		{
			if (life-- < 0) Sprite.spriteContext.removeSprite(this);
			x += xDelta;
			y += yDelta;
			yDelta *= 0.95f;
			yDelta += 3;
		}
	}
}